package com.wos.mpbao.action.mgr;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.Preparable;
import com.wos.mpbao.action.CommonAction;
import com.wos.mpbao.bean.Page;
import com.wos.mpbao.database.domain.KhhTest;
import com.wos.mpbao.service.KhhTestService;
import com.wos.mpbao.util.ParamUtil;
import com.wos.mpbao.util.StringUtil;

/**
 * KhhTestAction
 *
 */
public class KhhTestAction extends CommonAction implements Preparable {
	@Autowired private KhhTestService khhTestService;

	private KhhTest bean;
	private Page page;
	private List<Object> list;
	
	@Override
	public void prepare() throws Exception {
		
	}

	/**
	 * 买家列表
	 * @return
	 */
	public String list() {
		Map<String, Object> param = new HashMap<String, Object>();
		
		ParamUtil.addParam(param, "sellerNick", getSessionUser().getNick());
		
		page = new Page(10, "mgr/buyer_list.do", param);
		
		String startPage = request.getParameter("startPage");
		if (StringUtil.isNumeric(startPage)) {
			int pageNo = Integer.parseInt(startPage);
			page.setPageNo(pageNo);
		}
		
		List<KhhTest> list = khhTestService.selectList(page);
		page.setResult(list);
		return "success";
	}

	/**
	 * 编辑
	 * @return
	 */
	public String input() {
		
		return "input";
	}
	
	
	/**
	 * 查看信息
	 * @return
	 */
	public String info() {
		
		return "view";
	}
	
	
	/**
	 * 保存
	 * @return
	 */
	public String save() {
		
		return "action";
	}

	/**
	 * 删除
	 * @return
	 */
	public String del() {
		
		return "action";
	}

	public KhhTest getBean() {
		return bean;
	}

	public void setBean(KhhTest bean) {
		this.bean = bean;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public List<Object> getList() {
		return list;
	}

	public void setList(List<Object> list) {
		this.list = list;
	}

	
}
